#ifndef CONFIGDIALOG_H
#define CONFIGDIALOG_H

#include <QtCore/QObject>
#include <QtGui/QDialog>
#include <QtGui/QMessageBox>
#include <QtGui/QLineEdit>
#include <QFile.h>
#include <QDir.h>
#include <QTextstream.h>

#include "../bin/damagetopaintjob/ui_configdialog.h"
#include "IGUICallback.h"
#include "../Graphics/ConfigStructs.h"
#include "../GUI/QLineEditEx.h"
#include "../Network/CServer.h"
#include "../Network/CClient.h"
#include <QThread>

namespace Ui
{
    class Dialog;
}


enum UpdateWhat
{
	ServerLog,
	ChatWin
};

class ConfigDialog : public QDialog
{
    Q_OBJECT

public:
    ConfigDialog(QWidget *parent = 0);
    ~ConfigDialog();

public slots:
	void SendChatMessage();
	void AttemptConnection();
	void AttemptServerStart();
	void saveConfig();
	void setConfig(ConfigContainer *configContainer);
        void receive_UpdateServerLog(QString logMessage);
        void receive_UpdateChatWin(QString chatMessage);

signals:
	void SendUpdateGUI(const char* text, UpdateWhat uwUpdate);

private:
	Ui::Dialog *ui;
	Ui_Dialog *ThisUI;
	QString strYes;
	QString strNo;
        QThread* m_ServerThread;
        CServer* m_NetworkServer;
        QThread* m_ClientThread;
        CClient* m_NetworkClient;
        void UpdateServerLog(QString message);
        void UpdateChatWin(QString message);

public:
	QLineEditEx *test;
};

#endif // MAINWINDOW_H
